/*
 * This file is part of b.AMP.
 *
 * b.AMP is free software: you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * b.AMP is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with b.AMP.  If not, see <http://www.gnu.org/licenses/>.
 */

#include "service/message_loop.hpp"
#include "service/service.hpp"
#include "logger.hpp"
#include "playback_msg_wrap.hpp"
#include "playback.hpp"
#include <memory>


/*
 * Implementation.
 */
struct bamp::Playback::Implementation
{
    Implementation(bamp::Service& svc, bamp::PluginLoader& pl)
        : m_svc(svc), m_plugins(pl) {}

    // Message handler prototypes
    BAMP_PLAYBACK_MSG_DECLARE_ALL;

    // Internal functions
    void init();
    void cleanup();

    // Parent service object
    bamp::Service& m_svc;

    // System-wide plugin loader
    bamp::PluginLoader& m_plugins;
};



/*
 * Public interface.
 */

bamp::Playback::Playback(bamp::PluginLoader& pl)
    : pimpl(new Implementation(*this, pl))
{
    BAMP_PLAYBACK_MSG_CONNECT_ALL
        (thread(), bamp::Playback::Implementation, *pimpl);
}

bamp::Playback::~Playback()
{
    // Nothing here
}


/*
 * Internal functions.
 */

void bamp::Playback::Implementation::init()
{
    // TODO
}

void bamp::Playback::Implementation::cleanup()
{
    // TODO
}



/*
 * Messaging interface.
 */


void bamp::Playback::Implementation::play(MessagePtr msg)
{

}

void bamp::Playback::Implementation::pause(MessagePtr msg)
{

}

void bamp::Playback::Implementation::previous(MessagePtr msg)
{

}

void bamp::Playback::Implementation::next(MessagePtr msg)
{

}

void bamp::Playback::Implementation::seek(MessagePtr msg)
{

}


void bamp::Playback::Implementation::getMetadata(MessagePtr msg)
{

}

void bamp::Playback::Implementation::setMetadata(MessagePtr msg)
{

}

void bamp::Playback::Implementation::getPlaylistInfo(MessagePtr msg)
{

}

void bamp::Playback::Implementation::getPlaylistEntry(MessagePtr msg)
{

}

void bamp::Playback::Implementation::setPlaylistEntry(MessagePtr msg)
{

}

void bamp::Playback::Implementation::load(MessagePtr msg)
{

}

void bamp::Playback::Implementation::savePlaylist(MessagePtr msg)
{

}

void bamp::Playback::Implementation::exit(MessagePtr msg)
{
    cleanup();
    m_svc.stop();    
    BAMP_LOG_TRACE("playback subsystem stopping");
}
